home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
v10n18.arc
/
LN1018.ARC
/
MYSHELL.2
< prev
next >
Wrap
Text File
|
1991-10-30
|
1KB
|
37 lines
REM MyShell2
Declare Sub MyShell Lib "kernel" \
(lpCmdStr$, nCmdShow As Integer) \
Alias "WinExec"
Function Extension$(fname$)
If Len(fname$) < 4 Then maxi = Len(fname$) Else maxi = 4
s$ = Right$(fname$, maxi) ' extension has to be in last characters
If InStr(s$, "\") <> 0 Then ' must be tiny directory name, not extension
Extension$ = ""
Else
n = InStr(s$, ".")
If n = 0 Then Extension$ = "" Else \
Extension$ = Right$(fname$, maxi - n)
End If
End Function
Sub Launch(cmd$)
If InStr(cmd$, " ") Then ' if space in cmd$, then
MyShell cmd$, 1 ' must have program name already
Else
ext$ = Extension$(cmd$)
prog$ = GetProfileString$("extensions", ext$) ' program.exe ^.xxx
If prog$ = "" Then
MyShell cmd$, 1 ' nothing in [extensions]: assume program name
Else
prog$ = Left$(prog$, InStr(prog$, " ")) ' throw away ^.xxx
MyShell prog$ + " " + cmd$, 1
End If
End If
End Sub
Sub MAIN
Launch "foo.bmp" ' or any filename .EXT
End Sub